//
//  ZFunctionDefine.h
//  ZPlayer
//
//  Created by Zed Link on 29/11/2016.
//  Copyright © 2016 ZED. All rights reserved.
//

#ifndef ZFunctionDefine_h
#define ZFunctionDefine_h


//线上环境MainURL
#define RELEASE_BASE_URL @"http://www.weclubs.net:1203"
//开发环境
#define TEST_BASE_URL @"http://192.168.31.168:8080"

//channel
#define kAPPSource @"App Store"

// 单例
#define Z_SINGLETON_HEADER \
\
+ (instancetype)sharedInstance;

#define Z_SINGLETON_IMPLEMENTATION(className) \
\
static className *_instance = nil; \
static dispatch_once_t ZToken; \
\
+ (instancetype)sharedInstance { \
    dispatch_once(&ZToken, ^{ \
        _instance = [[super allocWithZone:NULL] init]; \
    }); \
    return _instance; \
} \
\
+ (id)allocWithZone:(NSZone *)zone { \
    return [self sharedInstance];\
} \
\
- (id)copyWithZone:(NSZone *)zone { \
    return self; \
}


// 调试输出
#ifdef DEBUG
#   define ZLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#   define ZLog(...)
#endif


// 引用相关
#define Z_WEAK_SELF __weak typeof(self) weakSelf = self;
#define Z_STRONG_WEAKSELF __strong typeof(weakSelf) strongSelf = weakSelf;


// 屏幕相关
#define Z_SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define Z_SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height
#define Z_IPHONE_WIDTH_REGULAR [[UIScreen mainScreen] currentMode].size.width > 750.0

#define KEY_WINDOW [UIApplication sharedApplication].keyWindow

//  Token失效
#define TOKEN_INVALIDATE_DESCRIPTION @"There has no token!"

// 加密
#define SECRET_WORD @"pukongjie"

//默认占位图片
#define defaultIcon [UIImage imageNamed:@"Icon-60"]

// 系统字体大小定义
#define kFont(F)                                [UIFont systemFontOfSize:F]


#endif /* ZFunctionDefine_h */
